package com.bdqn.bookshop.common;

/**
 * @author : 罗若然[LUO_RUO_RAN]
 * @date : 2020-07-24 10:37
 * 分类级别
 **/
public enum  ClassifyLevelEnum {

    DEFAULT(0, "ERROR"),
    LEVEL_ONE(1, "一级分类"),
    LEVEL_TWO(2, "二级分类");

    private int level;

    private String name;

    ClassifyLevelEnum(int level, String name) {
        this.level = level;
        this.name = name;
    }

    public static ClassifyLevelEnum getClassifyLevel(int level) {
        for (ClassifyLevelEnum classifyLevelEnum : ClassifyLevelEnum.values()) {
            if (classifyLevelEnum.getLevel() == level) {
                return classifyLevelEnum;
            }
        }
        return DEFAULT;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}
